package ua.com.stormlabs.tiny.licenseserver.service;

import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;
import ua.com.stormlabs.tiny.licenseserver.beans.User;
import ua.com.stormlabs.tiny.licenseserver.storage.DuplicateUserException;
import ua.com.stormlabs.tiny.licenseserver.storage.LicenseNotFoundException;
import ua.com.stormlabs.tiny.licenseserver.storage.RequestResult;
import ua.com.stormlabs.tiny.licenseserver.storage.UserNotFoundException;

import java.util.List;

/**
 * @author Maxim Bondarenko
 * @version 1.0 12/24/11
 */

@Transactional(readOnly = true)
public interface UsersService {

    RequestResult<User> listUsers(int pageNumber, int pageSize);

    RequestResult<User> listUsers(Pageable fetchLimits);

    List<User> listUsers(int licenseId);

    @Transactional
    User createUser(User user) throws DuplicateUserException, LicenseNotFoundException;

    User getUserByName(String userName) throws UserNotFoundException;

    User getUserById(int userId) throws UserNotFoundException;

    @Transactional
    void updateUser(User user) throws UserNotFoundException, LicenseNotFoundException;

    @Transactional
    void deleteUserById(int userId) throws UserNotFoundException;

    @Transactional
    void resetUserMac(int userId) throws UserNotFoundException;

    @Transactional
    void updateUserMac(int userId, String mac) throws UserNotFoundException;
}
